package com.yungu.swift.base.service;

import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.base.model.BaseDto;
import com.yungu.swift.base.model.PageVo;
import com.yungu.swift.base.model.admin.AdminPageParam;
import com.yungu.swift.base.model.api.ApiPageParam;

import java.util.List;
import java.util.Map;

/**
 * Created by yun on 2018/3/2
 */
public interface BaseService<T extends BaseDto> {

    ResponseData<Boolean> add(T instance);

    ResponseData<Boolean> edit(T instance);

    ResponseData<Boolean> del(T instance);

    ResponseData<Boolean> del(String uuid, Class<T> tClass);

    ResponseData<Integer> count(Map<String, Object> params);

    ResponseData<T> get(Map<String, Object> params);

    ResponseData<T> get(String uuid);

    ResponseData<List<T>> list(Map<String, Object> params);

    /**
     * 后台分页查询
     */
    <PageParam extends AdminPageParam> ResponseData<PageVo<T>> queryPage(PageParam pageParam);

    /**
     * 移动端分页查询
     *
     * @param map       查询参数
     * @param pageParam 分页参数
     */
    <PageParam extends ApiPageParam> ResponseData<PageList<T>> queryPage(Map<String, Object> map, PageParam pageParam);

    <PageParam extends ApiPageParam> ResponseData<PageList<T>> queryPage(PageParam pageParam);


}
